import { config } from '@vue/test-utils';
import { vi } from 'vitest';

// Mock CSS imports
vi.mock('*.css', () => ({}));
vi.mock('*.scss', () => ({}));

// 配置全局属性
config.global.mocks = {
	$t: (key: string) => key, // mock i18n
};

// Mock window.matchMedia
Object.defineProperty(window, 'matchMedia', {
	writable: true,
	value: vi.fn().mockImplementation(query => ({
		matches: false,
		media: query,
		onchange: null,
		addListener: vi.fn(),
		removeListener: vi.fn(),
		addEventListener: vi.fn(),
		removeEventListener: vi.fn(),
		dispatchEvent: vi.fn(),
	})),
});

// Mock IntersectionObserver
global.IntersectionObserver = class IntersectionObserver {
	// eslint-disable-next-line @typescript-eslint/no-empty-function
	constructor() {}
	// eslint-disable-next-line @typescript-eslint/no-empty-function
	disconnect() {}
	// eslint-disable-next-line @typescript-eslint/no-empty-function
	observe() {}
	takeRecords() {
		return [];
	}
	// eslint-disable-next-line @typescript-eslint/no-empty-function
	unobserve() {}
	// eslint-disable-next-line @typescript-eslint/no-explicit-any
} as any;
